/**
 * @Company      : 云集数字科技（山东）股份有限公司
 * @Author       : Lem clownpro@163.com
 */
class SseManager {
  constructor() {
    this.clients = new Set();
  }
  addClient(res) {
    this.clients.add(res);
    return res;
  }

  removeClient(res) {
    this.clients.delete(res);
  }

  send(data) {
    this.clients.forEach(client => {
      client.write(data);
    });
  }
}

module.exports = new SseManager();
